<div id="order-pay-dialog" class="order-pay-dialog-c" style="width:600px;">
	<h3><span id="order-pay-dialog-close" class="close" onclick="return X.boxClose();">关闭</span></h3>
	<div style="overflow-x:hidden;padding:10px;" id="dialog-order-id" oid="{$order['id']}">
	<form action="/biz/income/edit.php?id={$id}" method="post" enctype="multipart/form-data" class="validator" id="reg">
	<table width="96%" align="center" class="coupons-table" id="income">
		<tr><td width="80"><b>选择项目：</b></td><td><select name="team_id" id="income-dialog-team-id" onchange="getteam()" style="width:400px"><option value="0">请选择项目</option><!--{loop $teams $i $team}--><option value="{$team['id']}">ID{$team['id']}:${mb_strimwidth($team['title'],0,66,'...')}</option><!--{/loop}--></select></td></tr>
		<tr><td><b></b></td><td><span id="income_team_xx" style="font-size:12px; width:400px;"></span></td></tr>
		<tr><td><b>结算份数：</b></td><td><input id="income-dialog-number" name="number" value="" onblur="checkNumber()" style="width:100px;" /><span id="check_msg" style="font-size:12px; color:#FF0000;"></span></td></tr>
		<tr><td><b>备注：</b></td><td><textarea cols="45" rows="5" name="remarks" id="team-create-remarks" class="f-textarea editor" style="height:200px; width:400px;"></textarea></td></tr>
		<tr><td><b></b></td><td><input type="submit" value="结算" class="formbutton" /></td></tr>
	</table>
	</form>
	</div>
</div>
<script type="text/javascript">
function getteam(){
		s = $("#income-dialog-team-id").val();
		$("#income_team_xx").load('teampart.php?id='+encodeURIComponent(s) );
}
function checkNumber(){
	var tid = $("#income-dialog-team-id").val();
	var num = $("#income-dialog-number").val();
	if(tid == '0') {
		$('#check_msg').html("请选择项目");
		//return false;
	}
	else{
	$.get("check.php",{
		'id':tid,
		'num':num
		},function(data){
			if(data=='0'){
				document.getElementById("income-dialog-number").value = '';
				$('#check_msg').html("输入数量不能大于未结算份数或为0(未结算份数=已消费-已结算份数-待结算份数");
				//$('#check_msg').html("输入数量不能大于未结算份数或为0(未结算份数=实际出售份数-已结算份数-待结算份数");
				//return false;
				//document.FORM1.commit.disabled = true;
				//alert("输入数量不能大于未结算份数或为0(未结算份数=实际出售份数-已结算份数-待结算份数)");
			}
			else if(data=='1'){
				$('#check_msg').html("");
				//return true;
				//document.FORM1.commit.disabled = false;
			}
		});
	}
}
$('#reg').submit(function(){
	checkNumber();
	var num = $("#income-dialog-number").val();
	if (num) {return true;}else{return false;}
});
</script>
